#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;

int n, cnt = 0;
int a[N];
int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];

    for (int i = 3; i < n; ++i)
        if (a[i - 1] >= a[i] and a[i] < a[i + 1])
            ++cnt, ++i;
    cout << cnt;
    return 0;
}